package com.boby.lib_common.dialog

import android.content.Context
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.impl.LoadingPopupView


object LoadingDialog {

    fun create(context: Context,isDestroyOnDismiss: Boolean = false) =
        XPopup.Builder(context)
            .hasShadowBg(false)
            .isDestroyOnDismiss(isDestroyOnDismiss)
            .dismissOnTouchOutside(false)
            .dismissOnBackPressed(true)
            .asLoading("请稍等")



     fun showLoading(loadDialog: LoadingPopupView, message: String) {
         loadDialog.setTitle(message)
         loadDialog.show()
    }

    fun dismiss(loadDialog: LoadingPopupView){
        loadDialog.dismiss()
    }
}